package execption;

public class ThrowsDemo {
    public static void main(String[] args) {

        Student zs=new Student();
        try {
            zs.setAge(200);
        } catch (IllegalAgeException e) {
            System.out.println(e.getMessage());//获取错误信息并输出
            //e.printStackTrace();//打印错误栈跟踪信息
        }
        System.out.println("年龄"+zs.getAge()+"岁");

    }
}
